import {Form, Input, Modal, Select,InputNumber} from 'antd';
import {FormComponentProps} from 'antd/es/form';
import React, {Component} from 'react';
import {putTeacherCourse} from '../service';

const FormItem = Form.Item;
interface CreateFormProps extends FormComponentProps {
  modalVisible: boolean;
  onSubmit: (fieldsValue: any) => void;
  onCancel: () => void;
}

// class CreateForm extends Component<CreateFormProps> {
const CreateForm: React.FC<CreateFormProps> = props => {
  const {modalVisible,onSubmit: handleAdd, onCancel} = props;
  const [form] = Form.useForm();
    const {Option} = Select;
    const okHandle = async () => {
      const fieldsValue = await form.validateFields();
      form.resetFields();
      handleAdd(fieldsValue);
    };

    function handleChange(value) {
      console.log(`selected ${value}`);
    }

    function onChange(value) {
      console.log(`selected ${value}`);
    }

    function onBlur() {
      console.log('blur');
    }

    function onFocus() {
      console.log('focus');
    }

    function onSearch(val) {
      console.log('search:', val);
    }

    return (
      <Modal
        destroyOnClose
        title="修改成绩"
        visible={modalVisible}
        onOk={okHandle}
        onCancel={() => onCancel()}
      >
        <Form form={form}>
    <FormItem
      labelCol={{
        span: 5,
      }}
      wrapperCol={{
        span: 15,
      }}
      label="修改成绩"
      name="score"
    >
      <InputNumber min={1} max={100} defaultValue={70} onChange={onChange}/>
    </FormItem>
        </Form>
  </Modal>
      )

};

export default CreateForm;
